package com.dao;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import com.model.DefectStatus;
import com.util.DataUtil;

public class DefectStatusDAO {

	public ArrayList<DefectStatus> select() {
		ArrayList<DefectStatus> list = new ArrayList<DefectStatus>();

		Connection conn = DataUtil.getConnection();
		try {
			CallableStatement stmt = conn
					.prepareCall("{ Call usp_dms_DefectStatusSelect }");
			ResultSet rs = DataUtil.executeStore(stmt);
			// Gets entities from resultset
			while (rs.next()) {
				DefectStatus entity = new DefectStatus(rs.getInt("DefectStatus_Id"), rs
						.getString("DefectStatusName"));
				list.add(entity);// add to list
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			DataUtil.disconnected();
		}
		return (list.isEmpty()) ? null : list;
	}

	public DefectStatus select(int statusId) {
		return null;
	}
}
